target = zmq_vs
srcs = main.cpp server.cpp thread.cpp vs_opencv.cpp \
	   front_server.cpp front_thread.cpp gf_server.cpp gf_thread.cpp
libs = dip/gf/lib/libGlobalFeature_3_2_0.a dip/gf/input/lib/libAutoJudgeImage.a dip/gf/input/lib/libCenterExtract.a dip/gf/input/lib/libInvertedFileIndex.a \
	   dip/lf/lib/libLocalFeaturesSearch.a dip/lf/lib/libLocalFeaturesExtracter.a dip/lf/lib/libmainBody_1_2_1.a dip/lf/lib/libClusteringLibrary.a \
	   store/libstore.a log/lib/liblog.a

subdirs= log store
INCLUDE= -I./ -I/home/brght/usr/zeromq/include -Ilog/include/  -I./opencv/inc -I./store/ -I./store/bdb/include/ -Idip/gf/include -Idip/lf/include 

LIBRARY=-lpthread -lprotobuf -L/home/brght/usr/zeromq/lib -lzmq -Lopencv/lib/ -lcv -lhighgui -ldb -lcxcore -lssl -Lstore/bdb/lib/ proto.msg.pb.cc 

CPPFLAGS+=-g -fpic 
all : $(target)

objs=$(patsubst %.cpp, %.o, $(srcs))

all : $(target)

$(target) : $(objs) 
	for dir in $(subdirs); do make -C $$dir ; done
	g++ $(CPPFLAGS) $(INCLUDE) -o $(target) $^ $(libs) $(LIBRARY) 

%.o : %.cpp
	g++ $(INCLUDE) $(CPPFLAGS) $< -c -o $@

.PHONY : clean sclean
clean:
	rm -f $(objs)
	rm -f $(target)
sclean:
	for dir in $(subdirs); do make -C $$dir clean; done
	rm -f $(objs)
	rm -f $(target)

